//
// Created by Administrator on 2025/1/2.
//

#pragma once

#include "bsp_gpio.h"
#include "bsp_i2c.h"
#include "imu_info.h"
#include "main.h"

#define MPU6050_ADDRESS			0xD0

#define	MPU6050_SMPLRT_DIV		0x19
#define	MPU6050_CONFIG			0x1A
#define	MPU6050_GYRO_CONFIG		0x1B
#define	MPU6050_ACCEL_CONFIG	0x1C

#define	MPU6050_ACCEL_XOUT_H	0x3B
#define	MPU6050_ACCEL_XOUT_L	0x3C
#define	MPU6050_ACCEL_YOUT_H	0x3D
#define	MPU6050_ACCEL_YOUT_L	0x3E
#define	MPU6050_ACCEL_ZOUT_H	0x3F
#define	MPU6050_ACCEL_ZOUT_L	0x40
#define	MPU6050_TEMP_OUT_H		0x41
#define	MPU6050_TEMP_OUT_L		0x42
#define	MPU6050_GYRO_XOUT_H		0x43
#define	MPU6050_GYRO_XOUT_L		0x44
#define	MPU6050_GYRO_YOUT_H		0x45
#define	MPU6050_GYRO_YOUT_L		0x46
#define	MPU6050_GYRO_ZOUT_H		0x47
#define	MPU6050_GYRO_ZOUT_L		0x48

#define	MPU6050_PWR_MGMT_1		0x6B
#define	MPU6050_PWR_MGMT_2		0x6C
#define	MPU6050_WHO_AM_I		0x75

namespace mpu {
    typedef struct{
        bsp::I2C* i2c;
    }MPU6050_init_t;

    typedef struct {
        uint8_t mpu_data[14];
    } mpu6050_real_data_t;

    class MPU6050{
        public:
          MPU6050(MPU6050_init_t init);
          volatile uint8_t mpu_data[14];

        private:
          void Init();

          bsp::I2C* i2c_;

    };
} // namespace mpu

